<?php
/*
	系统可用函数查看
*/
defined('BY_JYA') or exit('error');
global $_RQ,$_AR;
$_RQ['op']=$_RQ['op']?$_RQ['op']:'list';
$return=array();

if($_RQ['op']=='list'){
	$params=array();
	if ($_RQ['title']){
		$params['title'] = $_RQ['title'];
	}
	if ($_RQ['plugin']){
		$params['plugin'] = $_RQ['plugin'];
	}
	$result=cloud_request('plugin.function.list',$params);
	$htmls=array(
		'type'=>'list',
		'tabs'=>array(
			array('op'=>'list','title'=>'函数列表'),
		),
		'list'=>array('data'=>'list','delall'=>false,'del_one'=>false,'edit'=>false,'list'=>array(
			'0'=>array('name'=>'name','title'=>'函数标识','type'=>'string'),
			'1'=>array('name'=>'title','title'=>'函数名称','type'=>'string'),
			'2'=>array('name'=>'plugin','title'=>'所属插件','type'=>'string'),
		),'actions'=>array(
			array('type'=>'href','name'=>'look','title'=>'查看详情')
		)),
		'search_one'=>array('name'=>'title','add'=>false,'select'=>true,'select_title'=>'请选择所属插件','options'=>'plugins','option_value'=>'name'),
	);
	$result['htmls']=$htmls;
	exi($result);
}
if($_RQ['op']=='look'){
	$id=intval($_RQ['id']);
	if(!$id){
		exi('参数错误！','error');
	}
	$params['id']=$id;
	$result=cloud_request('plugin.function.look',$params);
	$htmls=array(
		'type'=>'look',
		'desc'=>'函数详情',
		'tabs'=>array(
			'0'=>array('op'=>'list','title'=>'函数列表'),
		),
		'look'=>array(
			array('type'=>'string','title'=>'函数标识','data'=>$result['item']['name']),
			array('type'=>'string','title'=>'函数名称','data'=>$result['item']['title']),
			array('type'=>'string','title'=>'所属插件','data'=>$result['item']['plugin']),
			array('type'=>'string','title'=>'功能说明','data'=>$result['item']['content']),
			array('type'=>'array','title'=>'参数列表','data'=>$result['item']['params'],'list'=>array(
				array('name'=>'name','title'=>'参数标识'),
				array('name'=>'title','title'=>'参数名称'),
				array('name'=>'leixing','title'=>'参数类型'),
			)),
		)
	);
	$result['htmls']=$htmls;
	exi($result);
}
